﻿using System;
using System.Data;
using System.Linq;
using System.Windows;
using WPFExcelReport.Chart;
using System.Windows.Controls;
using WPFExcelReport.Helpers;
using System.ComponentModel;
using ReflectionStudio.Core.Events;
namespace WPFExcelReport
{
    /// <summary>
    /// Interaction logic for EditEventWindow.xaml
    /// </summary>
    public partial class TFVKP : UIVKPOS
    {
        public TFVKP()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VVKPOS();
            this.DataContext = MV; 
            InitializeComponent();
     
        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            IsInactive = false;
            if (dwMaster != null) 
            {
                if (TMV.VKPSA == "IN")
                    IsInactive = true;  
            }
        }
        public override void LOADBYAUF()
        { 
            if (ORDERNUM.Length < 8)
            { 
                return;
            }
            if (ORDERNUM.Substring(1, 8) != KRS + LFD)
            {
                KRS = ORDERNUM.Substring(1, 2);
                LFD = ORDERNUM.Substring(3, 6);
                dwData = TBMain.NewRow();
                dwData["VKPMANDANT"] = app.Mandant;
                dwData["VKPAUFKRS"] = " AND VKPAUFKRS='" + KRS + "'";
                dwData["VKPAUFLFD"] = " AND VKPAUFLFD='" + LFD + "'";
                SResult = TMV.QueryVKPOS(dwData, 21);
                MergeData(SResult, true, true);
            }
        }
       
    }
   
}
